package task.gui;

import java.io.IOException;
import java.io.OutputStream;

import org.eclipse.swt.widgets.Text;

public class TextOutputStream extends OutputStream {
	private Text text;
	private StringBuilder sb = new StringBuilder();
	public TextOutputStream(Text text) {
		this.text = text;
	}
	@Override
	public void write(int ch) throws IOException {
		sb.append((char)ch);
		switch (ch) {
		case '\n':
		case '\r':
			text.append(sb.toString());
			sb = new StringBuilder();
		}
	}

}
